package com.cardvalue.sys.fragment;

import android.app.Activity;
import android.content.ContentResolver;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.ContactsContract;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.cardvalue.sys.R;
import com.cardvalue.sys.activity.CreditReportActivity;
import com.cardvalue.sys.activity.IsJxlValidActivity;
import com.cardvalue.sys.activity.LinkActivity;
import com.cardvalue.sys.base.BaseFragment;
import com.cardvalue.sys.cache.LocalCache;
import com.cardvalue.sys.code.CallBackCode;
import com.cardvalue.sys.entity.Address;
import com.cardvalue.sys.entity.Apply;
import com.cardvalue.sys.entity.FileListOnce;
import com.cardvalue.sys.entity.FileListSecond;
import com.cardvalue.sys.entity.FileListThree;
import com.cardvalue.sys.entity.SelHasLeaseContract;
import com.cardvalue.sys.entity.User;
import com.cardvalue.sys.mode.UserService;
import com.cardvalue.sys.tool.CheckingForm;
import com.cardvalue.sys.tool.MessageBox;
import com.cardvalue.sys.tool.Utiltools;
import com.cardvalue.sys.widget.BirthDateDialog;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.realm.RealmList;
import timber.log.Timber;

/**
 * 申请页面
 * Created by cardvalue on 2016/3/30.
 */
public class UploadFragment extends BaseFragment{
    @Bind(R.id.creditReportStatus) TextView   creditReportStatus;//征信报告
    @Bind(R.id.isJxlValid) TextView   isJxlValid;//手机验证
    @Bind(R.id.couponIds)  TextView   couponIds; //使用优惠券
    @Bind(R.id.ownerAddress) EditText ownerAddress; //居住地址
    @Bind(R.id.directType)  TextView   directType; //直系亲属类型
    @Bind(R.id.directName)  TextView   directName; //直系亲属姓名
    @Bind(R.id.directPhone)  EditText   directPhone; //直系亲属手机
    @Bind(R.id.tv_se_phone) TextView  tv_se_phone;//选择直系亲属手机号码
    @Bind(R.id.emergencyName)  EditText   emergencyName; //紧急联系人姓名
    @Bind(R.id.tv_se_name)  TextView  tv_se_name;//选择紧急联系人手机号码  和姓名
    @Bind(R.id.emergencyPhone)  EditText   emergencyPhone; //紧急联系人手机
    @Bind(R.id.hasLeaseContract)  TextView   hasLeaseContract; //是否有租赁合同
    @Bind(R.id.landlordPhone)  EditText   landlordPhone; //房东电话号码
    @Bind(R.id.noLeaseContractReason)  TextView   noLeaseContractReason; //为何没有租凭合同
    @Bind(R.id.leaseContractStartTime)  TextView   leaseContractStartTime; //合同开始时间
    @Bind(R.id.leaseContractEndTime)  TextView   leaseContractEndTime; //合同结束时间
    @Bind(R.id.leaseYearAmt)  EditText   leaseYearAmt; //年租金
    @Bind(R.id.proprietorName)  EditText   proprietorName; //业主姓名
    @Bind(R.id.proprietorPhone)  EditText   proprietorPhone; //业主电话
    @Bind(R.id.time_tv)  TextView  time_tv;//选择时间隐藏的

    @Bind(R.id.noLeaseContractReason_ly)  LinearLayout  noLeaseContractReason_ly;
    @Bind(R.id.landlordPhone_ly) LinearLayout landlordPhone_ly;
    @Bind(R.id.leaseContractStartTime_ly)  LinearLayout  leaseContractStartTime_ly;
    @Bind(R.id.leaseContractEndTime_ly)  LinearLayout  leaseContractEndTime_ly;
    @Bind(R.id.leaseYearAmt_ly)  LinearLayout  leaseYearAmt_ly;
    @Bind(R.id.proprietorName_ly)  LinearLayout  proprietorName_ly;
    @Bind(R.id.proprietorPhone_ly)  LinearLayout  proprietorPhone_ly;

    @Bind(R.id.listView1) ListView list;



    @Bind(R.id.button) TextView button;//点击事件
    public static Handler handler;
    public  BirthDateDialog birthDiolog ;//时间
    private  String phoneSet;//用于判断选择号码
    private UserService updateInfo;//获取用户

    private  String mownerAddress;//地址
    private  String mdirectType;//直系亲属类型
    private  String mdirectName;//直系亲属姓名
    private  String mdirectPhone;//直系亲属手机
    private  String memergencyName;//紧急联系人姓名
    private  String memergencyPhone;//紧急联系人手机
    private  String mhasLeaseContract; //是否有租赁合同   1：有，0：无

    private  String  mlandlordPhone;//房东号码
    private  String mnoLeaseContractReason;//为何没有租凭合同
    private  String mleaseContractStartTime;//合同开始时间
    private  String mleaseContractEndTime;//合同结束时间
    private  String mleaseYearAmt;//年租金
    private  String mproprietorName;//业主姓名
    private  String mproprietorPhone;//业主电话
    String hasLeaseContractId;
    String noLeaseContractReasonId;
    private List<FileListSecond> mFileListresults= new ArrayList<>();
    private List<FileListThree> mFileListThree= new ArrayList<>();
    private Map<String ,Object>  mapFileListThree;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_upload,container, false);
        ButterKnife.bind(this,view);
        updateInfo=new UserService(getActivity());
        userInfo();//获取用户
        //   getFile();//获取图片列表
        handler=new Handler(){
            @Override
            public void handleMessage(android.os.Message msg) {
                super.handleMessage(msg);
                if(msg.what== CallBackCode.CALLBACK_MSG_GETDIRECTTYPE){//直系亲属类型
                    Bundle bundle=msg.getData();
                    directType.setText(bundle.get("title").toString());
                }else if(msg.what==CallBackCode.CALLBACK_MSG_GETSELHASLEASECONTRACT){//是否有租赁合同
                    Bundle bundle=msg.getData();
                    hasLeaseContract.setText(bundle.get("title").toString());
                    hasLeaseContractId=bundle.get("id")+"";
                    initView();
                }else if(msg.what== CallBackCode.CALLBACK_MSG_GETSELNOLEASECONTRACTREASON){//为何没有租赁合同
                    Bundle bundle=msg.getData();
                    noLeaseContractReason.setText(bundle.get("title").toString());
                    noLeaseContractReasonId=bundle.get("id")+"";
                    initView();
                }else if(msg.what==CallBackCode.CALLBACK_MSG_GETISJXIVALID){//手机验证
                    userInfo();//获取用户
                }
                super.handleMessage(msg);
            }
        };
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    @OnClick({R.id.creditReportStatus,R.id.isJxlValid,R.id.couponIds,
            R.id.directType,R.id.hasLeaseContract,R.id.noLeaseContractReason,
            R.id.tv_se_phone,R.id.tv_se_name,R.id.leaseContractStartTime,
            R.id.leaseContractEndTime,R.id.button})  void  click(View view){
        switch (view.getId()){
            case R.id.creditReportStatus://征信报告
                startActivity(new Intent(getActivity(), CreditReportActivity.class));
                break;
            case R.id.isJxlValid://手机验证
                startActivity(new Intent(getActivity(), IsJxlValidActivity.class));
                break;
            case R.id.couponIds://使用优惠券
                startActivity(new Intent(getActivity(), IsJxlValidActivity.class));
                break;
            case R.id.directType://直系亲属类型
                Intent intent=new Intent(getActivity(),LinkActivity.class);
                intent.putExtra("tagName","directType");
                startActivity(intent);
                break;
            case R.id.hasLeaseContract://是否有租赁合同
                Intent intentContract=new Intent(getActivity(),LinkActivity.class);
                intentContract.putExtra("tagName","hasLeaseContract");
                startActivity(intentContract);
                break;
            case R.id.noLeaseContractReason://为何没有租凭合同
                Intent intentNoContract=new Intent(getActivity(),LinkActivity.class);
                intentNoContract.putExtra("tagName","noLeaseContractReason");
                startActivity(intentNoContract);
                break;
            case R.id.leaseContractStartTime://合同开始时间
                phoneSet="R.id.leaseContractStartTime";
                getDate();
                findView();
                break;
            case R.id.leaseContractEndTime://合同结束时间
                phoneSet="R.id.leaseContractEndTime";
                getDate();
                findView();
                break;
            case R.id.tv_se_phone://选择直系亲属手机号码
                phoneSet="R.id.tv_se_phone";
                startActivityForResult(new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI), 0);
                break;
            case R.id.tv_se_name://选择紧急联系人手机号码  和姓名
                phoneSet="R.id.tv_se_name";
                startActivityForResult(new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI), 0);
                break;
            case R.id.button://点击按钮提交
                findView();
                User user=new User();
                if(!CheckingForm.checkForUpFile(mownerAddress,mdirectType,mdirectName,mdirectPhone,
                        memergencyName,memergencyPhone,mhasLeaseContract)){
                    MessageBox.ToastShow(CheckingForm.LastError,getActivity());
                    return;
                }
                if(mhasLeaseContract.equals("有")){
                    if(mlandlordPhone.equals("")){
                        MessageBox.ToastShow("房东手机号码不能为空",getActivity());
                        return;
                    }else
                        user.setLandlordPhone(mlandlordPhone);
                }else if(mhasLeaseContract.equals("无")){
                    if(mnoLeaseContractReason.equals("")){
                        MessageBox.ToastShow("为何没有租凭合同不能为空",getActivity());
                        return;
                    }else
                        user.setNoLeaseContractReason(noLeaseContractReasonId);


                    if(mnoLeaseContractReason.equals("自有房产")){
                    }else if(mnoLeaseContractReason.equals("无偿使用")){
                        if(mproprietorName.equals("")){//业主姓名 和业主电话
                            MessageBox.ToastShow("业主姓名不能为空",getActivity());
                            return;
                        }else if(mproprietorPhone.equals("")){
                            MessageBox.ToastShow("业主电话不能为空",getActivity());
                            return;
                        }
                        user.setProprietorName(mproprietorName);
                        user.setProprietorPhone(mproprietorPhone);
                    }else if(mnoLeaseContractReason.equals("合同丢失")){
                        if(mleaseContractStartTime.equals("")){
                            MessageBox.ToastShow("合同开始时间不能为空",getActivity());
                            return;
                        }else if(mleaseContractEndTime.equals("")){
                            MessageBox.ToastShow("合同结束时间不能为空",getActivity());
                            return;
                        }else if(mleaseYearAmt.equals("")){
                            MessageBox.ToastShow("年租金不能为空",getActivity());
                            return;
                        }else if(mproprietorName.equals("")){//业主姓名 和业主电话
                            MessageBox.ToastShow("业主姓名不能为空",getActivity());
                            return;
                        }else if(mproprietorPhone.equals("")){
                            MessageBox.ToastShow("业主电话不能为空",getActivity());
                            return;
                        }
                        user.setLeaseContractStartTime(mleaseContractStartTime);
                        user.setLeaseContractEndTime(mleaseContractEndTime);
                        user.setLeaseYearAmt(mleaseYearAmt);
                        user.setProprietorName(mproprietorName);
                        user.setProprietorPhone(mproprietorPhone);
                    }
                }
                user.setOwnerAddress(mownerAddress);
                user.setDirectType(mdirectType);
                user.setDirectName(mdirectName);
                user.setDirectPhone(mdirectPhone);
                user.setEmergencyName(memergencyName);
                user.setEmergencyPhone(memergencyPhone);
                user.setHasLeaseContract(mhasLeaseContract);


                updateInfo.updateInfo(user, new UserService.UsesrCallback() {//更新用户
                    @Override
                    public void success(User userInfo) {

                    }

                    @Override
                    public void fail(String msg) {

                    }

                    @Override
                    public void cancelDialog() {

                    }
                });
                break;
        }
    }


    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(resultCode== Activity.RESULT_CANCELED){
            return;
        }
        if(requestCode==0){
            ContentResolver reContentResolverol = getActivity().getContentResolver();
            Uri contactData = data.getData();
            @SuppressWarnings("deprecation")
            Cursor cursor = getActivity().managedQuery(contactData, null, null, null, null);
            cursor.moveToFirst();
            String username = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));//联系人姓名
            String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
            Cursor phone = reContentResolverol.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
                    ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null, null);
            while (phone.moveToNext()) {
                String usernumber = phone.getString(phone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                if(phoneSet.equals("R.id.tv_se_phone")){
                    directPhone.setText(Utiltools.removeAllSpace(usernumber));
                }else if(phoneSet.equals("R.id.tv_se_name")){
                    emergencyName.setText(username);
                    emergencyPhone.setText(Utiltools.removeAllSpace(usernumber));
                }
            }
        }
    }

    //时间
    public void getDate() {
        DisplayMetrics dm = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;
        int height = dm.heightPixels;
        //最后付款时间
        String curDate ="";
        if(phoneSet.equals("R.id.leaseContractStartTime")){
            curDate = leaseContractStartTime.getText().toString();
        }else if(phoneSet.equals("R.id.leaseContractEndTime")){
            curDate = leaseContractEndTime.getText().toString();
        }
        int[] date = getYMDArray(curDate, "-");
        int[] time = getYMDArray(time_tv.getText().toString(), ":");
        birthDiolog=new BirthDateDialog(getActivity(), new BirthDateDialog.PriorityListener() {
            @Override
            public void refreshPriorityUI(String year, String month,
                                          String day, String hours, String mins) {
                if(phoneSet.equals("R.id.leaseContractStartTime")){
                    leaseContractStartTime.setText(year + "-" + month + "-" + day);
                    time_tv.setText("00" + ":" + "00");
                }else if(phoneSet.equals("R.id.leaseContractEndTime")){
                    leaseContractEndTime.setText(year + "-" + month + "-" + day);
                }

            }
        }, date[0], date[1], date[2], time[0], time[1], time[2], width,
                height, "");
        Window window = birthDiolog.getWindow();
        window.setGravity(Gravity.BOTTOM); // 此处可以设置dialog显示的位置
        window.setWindowAnimations(R.style.dialogstyle); // 添加动画
        birthDiolog.setCancelable(true);
        birthDiolog.show();
        birthDiolog.setOnKeyListener(onKeyListener);
        birthDiolog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                dialog.cancel();
            }
        });

        birthDiolog.setOnDismissListener(new DialogInterface.OnDismissListener() {

            public void onDismiss(DialogInterface dialog) {
                // TODO Auto-generated method stub
                dialog.cancel();
            }
        });
    }



    public DialogInterface.OnKeyListener onKeyListener = new DialogInterface.OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            // TODO Auto-generated method stub
            if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
                dismissDialog();

            }
            dialog.cancel();
            return false;
        }
    };


    public void dismissDialog() {
        if (getActivity().isFinishing()) {
            getActivity().finish();
            return;
        }
        if (null != birthDiolog && birthDiolog.isShowing()) {
            birthDiolog.dismiss();
            getActivity().finish();
        }
        getActivity().finish();
    }
    /**
     * 时间截取
     *
     * @param datetime
     * @param splite
     * @return
     */
    public static int[] getYMDArray(String datetime, String splite) {
        int date[] = { 0, 0, 0, 0, 0 };
        if (datetime != null && datetime.length() > 0) {
            String[] dates = datetime.split(splite);
            int position = 0;
            for (String temp : dates) {
                date[position] = Integer.valueOf(temp);
                position++;
            }
        }
        return date;
    }


    /***
     * 获取用户
     */
    public void  userInfo(){
        updateInfo.latesApplication(new UserService.GetApplyCallback() {//获取申请
            @Override
            public void success(Apply apply) {
                creditReportStatus.setText(apply.getCreditReportStatus().equals("0")?"未验证":"已验证");
                if(!apply.getCreditReportStatus().equals("0")){
                    creditReportStatus.setTextColor(getResources().getColor(R.color.bg_home));
                }else {
                    creditReportStatus.setTextColor(getResources().getColor(R.color.c8c8ce));
                }

            }

            @Override
            public void fail(String msg) {

            }

            @Override
            public void cancelDialog() {

            }
        });
        updateInfo.getGetUserInfo(LocalCache.getStringLocalData(getActivity(), "objectId"), new UserService.UsesrCallback() {
            @Override
            public void success(User userInfo) {
                userInfoData(userInfo);
            }

            @Override
            public void fail(String msg) {

            }

            @Override
            public void cancelDialog() {

            }
        });
    }

    /**
     * 设置数据
     */
    public void userInfoData(User userInfo){
        //  creditReportStatus.setText(userInfo); //在申请对象中
        Utiltools.printE("====","手机验证======过来的========");
        Timber.e("====手机验证======过来的========");
        isJxlValid.setText(userInfo.getIsJxlValid().equals("0")?"未验证":"已验证");
        if(userInfo.getIsJxlValid().equals("1")){
            isJxlValid.setTextColor(getResources().getColor(R.color.bg_home));
        }else{
            isJxlValid.setTextColor(getResources().getColor(R.color.c8c8ce));
        }
        //  couponIds
        ownerAddress.setText(userInfo.getOwnerAddress());
        directType.setText(userInfo.getDirectType()); //直系亲属类型
        directName.setText(userInfo.getDirectName()); //直系亲属姓名
        directPhone.setText(userInfo.getDirectPhone()); //直系亲属手机
        emergencyName.setText(userInfo.getEmergencyName()); //紧急联系人姓名
        emergencyPhone.setText(userInfo.getEmergencyPhone()); //紧急联系人手机
        //是否有租赁合同   1：有，0：无
        List<SelHasLeaseContract>  listsehas= userInfo.getSelHasLeaseContract();
        if(userInfo.getHasLeaseContract()!=null&&!userInfo.getHasLeaseContract().equals("")){
            hasLeaseContract.setText(listsehas.get(Integer.parseInt(userInfo.getHasLeaseContract())).getTitle());
        }
        landlordPhone.setText(userInfo.getLandlordPhone()); //房东电话号码
        //为何没有租凭合同  1：自有房产，2：无偿使用，3：合同丢失
        List<SelHasLeaseContract>  listsel= userInfo.getSelNoLeaseContractReason();
        if(userInfo.getNoLeaseContractReason()!=null&&!userInfo.getNoLeaseContractReason().equals("")){
            noLeaseContractReason.setText(listsel.get(Integer.parseInt(userInfo.getNoLeaseContractReason())-1).getTitle());
        }
        leaseYearAmt.setText(userInfo.getLeaseYearAmt());//年租金
        proprietorName.setText(userInfo.getProprietorName()); //业主姓名
        proprietorPhone.setText(userInfo.getProprietorPhone()); //业主电话

        leaseContractStartTime.setText(userInfo.getLeaseContractStartTime().toString().replace(" 00:00:00",""));
        leaseContractEndTime.setText(userInfo.getLeaseContractEndTime().toString().replace(" 00:00:00",""));
        initView();
    }



    public void initView(){
        findView();
        Utiltools.printE("mhasLeaseContract",!TextUtils.isEmpty(mhasLeaseContract)+"=1=");
        if(!TextUtils.isEmpty(mhasLeaseContract)) {
            Utiltools.printE("mhasLeaseContract",mhasLeaseContract+"=2=");
            if (mhasLeaseContract.equals("有")) {
                landlordPhone_ly.setVisibility(View.VISIBLE);//房东号码
                noLeaseContractReason_ly.setVisibility(View.GONE);//为何没有租凭合同
                leaseContractStartTime_ly.setVisibility(View.GONE);//合同开始时间
                leaseContractEndTime_ly.setVisibility(View.GONE);//合同结束时间
                leaseYearAmt_ly.setVisibility(View.GONE);//年租金
                proprietorName_ly.setVisibility(View.GONE);//业主姓名
                proprietorPhone_ly.setVisibility(View.GONE);//业主电话
            } else if (mhasLeaseContract.equals("无")) {
                landlordPhone_ly.setVisibility(View.GONE);//房东号码
                noLeaseContractReason_ly.setVisibility(View.VISIBLE);//为何没有租凭合同
               /* leaseContractStartTime_ly.setVisibility(View.GONE);//合同开始时间
                leaseContractEndTime_ly.setVisibility(View.GONE);//合同结束时间
                leaseYearAmt_ly.setVisibility(View.GONE);//年租金
                proprietorName_ly.setVisibility(View.GONE);//业主姓名
                proprietorPhone_ly.setVisibility(View.GONE);//业主电话*/
                if (!TextUtils.isEmpty(mnoLeaseContractReason)) {
                    if (mnoLeaseContractReason.equals("自有房产")) {
                        landlordPhone_ly.setVisibility(View.GONE);//房东号码
                        leaseContractStartTime_ly.setVisibility(View.GONE);//合同开始时间
                        leaseContractEndTime_ly.setVisibility(View.GONE);//合同结束时间
                        leaseYearAmt_ly.setVisibility(View.GONE);//年租金
                        proprietorName_ly.setVisibility(View.GONE);//业主姓名
                        proprietorPhone_ly.setVisibility(View.GONE);//业主电话
                    } else if (mnoLeaseContractReason.equals("无偿使用")) {
                        landlordPhone_ly.setVisibility(View.GONE);//房东号码
                        leaseContractStartTime_ly.setVisibility(View.GONE);//合同开始时间
                        leaseContractEndTime_ly.setVisibility(View.GONE);//合同结束时间
                        leaseYearAmt_ly.setVisibility(View.GONE);//年租金
                        proprietorName_ly.setVisibility(View.VISIBLE);//业主姓名
                        proprietorPhone_ly.setVisibility(View.VISIBLE);//业主电话
                    } else if (mnoLeaseContractReason.equals("合同丢失")) {
                        landlordPhone_ly.setVisibility(View.GONE);//房东号码
                        leaseContractStartTime_ly.setVisibility(View.VISIBLE);//合同开始时间
                        leaseContractEndTime_ly.setVisibility(View.VISIBLE);//合同结束时间
                        leaseYearAmt_ly.setVisibility(View.VISIBLE);//年租金
                        proprietorName_ly.setVisibility(View.VISIBLE);//业主姓名
                        proprietorPhone_ly.setVisibility(View.VISIBLE);//业主电话
                    }
                }
            }
        }

    }



    public void findView(){
        mownerAddress=ownerAddress.getText().toString();//地址
        mdirectType=directType.getText().toString();//直系亲属类型
        mdirectName=directName.getText().toString();//直系亲属姓名
        mdirectPhone=directPhone.getText().toString();//直系亲属手机
        memergencyName=emergencyName.getText().toString();//紧急联系人姓名
        memergencyPhone=emergencyPhone.getText().toString();//紧急联系人手机
        mhasLeaseContract=hasLeaseContract.getText().toString(); //是否有租赁合同   1：有，0：无

        mlandlordPhone=landlordPhone.getText().toString();//房东号码
        mnoLeaseContractReason=noLeaseContractReason.getText().toString();//为何没有租凭合同
        mleaseContractStartTime=leaseContractStartTime.getText().toString();//合同开始时间
        mleaseContractEndTime=leaseContractEndTime.getText().toString();//合同结束时间
        mleaseYearAmt=leaseYearAmt.getText().toString();//年租金
        mproprietorName=proprietorName.getText().toString();//业主姓名
        mproprietorPhone=proprietorPhone.getText().toString();//业主电话
    }

    /**
     * 进入页面获取图片列表
     */
    public void getFile(){
        updateInfo.getqueryUploadFileList(new UserService.GetFileListOnceCallback() {
            @Override
            public void success(FileListOnce fileListOnce) {
                mFileListresults=fileListOnce.getResults();//results
                Utiltools.printE("===进入页面获取图片列表===", JSON.toJSONString(mFileListresults)+"====999===");
               /* for (FileListSecond s:mFileListresults) {
                    List<FileListThree> threes = s.getFiles();
                }*/

                for (FileListSecond temp : mFileListresults) {
                    FileListSecond tpm=new FileListSecond();
                    if(temp.getTitle()!=null||!temp.getTitle().equals("")){
                        tpm.setTitle(temp.getTitle());
                        tpm.setLackFiles(temp.getLackFiles());
                        tpm.setChecklistId(temp.getChecklistId());
                        tpm.setRfe(temp.getRfe());
                    }
                    List<FileListSecond> pics = new ArrayList<>();
                    FileListSecond tp ;
                    if(temp.getDemo()!=null){
                        tp =new FileListSecond();
                        tp.setDemo("demo");
                        tp.setUrl(temp.getDemo());
                        tp.setChecklistId(temp.getChecklistId());
                        tp.setLackFiles(temp.getLackFiles());
                        tp.setLackFiles(temp.getLackFiles());
                        pics.add(tp);
                    }
                    mFileListresults.add(tpm);

                    FileListThree  tp1= new FileListThree();
                    // pics.addAll((List<>)temp.getFiles());
                  /*  //if (!isHasCreditLocked()){
                   FileListThree tp2 =new FileListThree();
                        tp2.setIsCommand("true");
                        tp2.setChecklistId(temp.getChecklistId());
                        pics.add(tp2);
                  //  }
                   tp1.setUrl(pics);
                   mFileListresults.add(tp1);*/
                }


            }

            @Override
            public void fail(String fileListOnce) {

            }

            @Override
            public void cancelDialog() {

            }
        });
    }
}
